"""
   1：拷贝
   2：可变对象
"""
import copy

"""
    浅拷贝， 只拷贝最外层对象， 数据半共享
"""
list1 = [1, 2, 3, [1, 2, 3, 4]]
list2 = copy.copy(list1)
print("list1 is %s" % id(list1), "lists2 is %s" % id(list2) )  # >>> list1 is 1887136033600 lists2 is 1887138883200
print("list1sub is %s" % id(list1[3]), "lists2sub is %s" % id(list2[3]) ) # >>> list1sub is 2340454293888 lists2sub is 2340454293888

"""
    深拷贝
"""
list3 = copy.deepcopy(list1)
print("list1sub is %s" % id(list1[3]), "list3sub is %s" % id(list3[3]) ) # >>> list1sub is 2303187837312 list3sub is 2303191504832

"""
    可变对象， 对象可以做修改，但是内存地址不会发生改变
    列表list 元组tuple 字典dict 集合set
    
    不可变对象
    int str tuple 
"""